/****************************************************************************
**
** EntryText.h
**
** Copyright (C) August 2014 Hotride
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
*****************************************************************************
*/
//---------------------------------------------------------------------------
#ifndef EntryTextH
#define EntryTextH
//---------------------------------------------------------------------------
class TEntryText
{
private:
	wstring m_Text;
	char m_CData[100];
	int m_MaxLength;
	int m_Position;

public:
	TEntryText();
	~TEntryText() {}
	
	void Clear();

	void Insert(wchar_t ch);
	void Remove(bool left);

	void AddPos(int val);
	void SetPos(int val);

	const wchar_t *Data() const {return m_Text.c_str();}
	const char *c_str()
	{
		int len = uucode2str(m_Text.c_str(), m_Text.length(), m_CData, 100);
		return (char*)m_CData;
	}

	void SetText(const string &text);
	void SetText(const wstring &text);

	void SetMaxLength(int max);

	int Pos() const {return m_Position;}

	int Length() const {return m_Text.length();}

	void DrawA(BYTE font, WORD color, float X, float Y);
	void DrawW(BYTE font, WORD color, WORD flags, float X, float Y);
};
//---------------------------------------------------------------------------
#endif